package cn.wgx.module.mind.web;

import cn.wgx.common.util.ResponseDataUtil;
import cn.wgx.module.mind.service.DirectorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@Api(tags = "00.0 总导演")
@RestController
@RequestMapping("/api/director")
public class DirectorCtrl {

    @Autowired
    private DirectorService directorService;

    @ApiOperation(value = "总列表",notes = "根据项目ID获取全部数据树结构")
    @GetMapping("getAll")
    public Map getScriptByProId(@RequestParam Integer pro_id,
                                @RequestParam(required = false, defaultValue = "false") Boolean tree){
        return ResponseDataUtil.returnData(directorService.getAll(pro_id,tree));
    }


    @ApiOperation(value = "导出文档",notes = "根据项目ID导出节点文本")
    @GetMapping("exportWord")
    public Map exportWord(@RequestParam Integer pro_id, HttpServletResponse response){

        return ResponseDataUtil.returnData(directorService.exportB(pro_id, response));
    }

    @ApiOperation(value = "导出文档",notes = "根据项目ID导出节点文本")
    @GetMapping("mp4")
    public Map exportMp4(@RequestParam Integer pro_id, HttpServletResponse response){

        return ResponseDataUtil.returnData(directorService.exportMp4(pro_id, response));
    }

}
